package org.yx.service.smfr.view_operation;

import org.dbist.dml.Page;
import org.dbist.dml.Query;
import org.yx.models.SmfrOprDef;
import org.yx.utils.BaseService;

import com.xiaoleilu.hutool.util.StrUtil;

/**
 * 查询工序信息
 * @author zxw
 * @since 2018/03/28
**/
public class SmfrViewOperationService extends BaseService {
	public SmfrViewOperationOut viewOperation(SmfrViewOperationIn in) throws Exception {
		Query query = new Query(in.getPageIndex(), in.getPageSize());
		query.addFilter("orgCode", in.getUserOrgCode());
		if (!StrUtil.isBlank(in.getOper())) {
			query.addFilter("oper", in.getOper());
		}
		query.addFilter("operStatus", "<>", 'D');
		query.addOrder("oper", true);

		Page<SmfrOprDef> operPage = selectPage(SmfrOprDef.class, query);

		SmfrViewOperationOut out = new SmfrViewOperationOut();
		out.setTotalSize(operPage.getTotalSize());
		out.setOperList(operPage.getList());

		return out;
	}
}